{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1b5ee48e-2338-47d6-8ebf-b2a98f453cdc",
   "metadata": {},
   "source": [
    "# 从Scikit-learn导入鸢尾花数据集\n",
    "\n",
    "Book_1《编程不难》 | 鸢尾花书：从加减乘除到机器学习  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "aa357a07-6a5c-4f31-ab9f-bae8b9657192",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 导入包\n",
    "from sklearn.datasets import load_iris"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "9db879a6-7784-4e5e-9d78-813c9fda5ae6",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 使用load_iris函数加载Iris数据集\n",
    "iris = load_iris()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "df77b74c-4c55-473f-a44e-24b997736762",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "numpy.ndarray"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Iris数据集的特征存储在iris.data中\n",
    "X = iris.data\n",
    "type(X) # numpy.ndarray"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "bda430d1-f838-4593-9993-8a633ec757e4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "numpy.ndarray"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Iris数据集的目标（标签）存储在iris.target中\n",
    "y = iris.target\n",
    "type(y) # numpy.ndarray"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
